package behavioralPattern.command.example01;

/**
 * 具体命令角色
 */
public class OrderCommand implements Command{

    // 维护一个接收者对象
    private Chef receiver;

    private Order order;

    public OrderCommand(Chef receiver, Order order) {
        this.receiver = receiver;
        this.order = order;
    }

    @Override
    public void execute() {
        receiver.makeFood(order); // 调用接收者对象的方法
        System.out.println(order.getDiningTable() + "桌已上菜");
        System.out.println("=========================\n");
    }
}
